package com.xquant.system.thread;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xquant.system.entity.TwcBndPrimaryKeyTest;
import com.xquant.system.mapper.TwcBndPrimaryKeyTestMapper;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;
import java.util.concurrent.Callable;


@Data
@AllArgsConstructor
@NoArgsConstructor
public class SelectTask implements Callable<List<TwcBndPrimaryKeyTest>> {

    private TwcBndPrimaryKeyTestMapper twcBndPrimaryKeyTestMapper;

    private int dataSource;


    @Override
    public List<TwcBndPrimaryKeyTest> call() throws Exception {

        QueryWrapper<TwcBndPrimaryKeyTest> twcBndPrimaryKeyTestQueryWrapper = new QueryWrapper<>();

        twcBndPrimaryKeyTestQueryWrapper.eq("DATA_SOURCE", dataSource);
        //不是衡泰数据源做增量查询
        if (dataSource != 1){
            twcBndPrimaryKeyTestQueryWrapper
                    .isNull("SEC_CODE")
                    .isNull("D_CODE");
        }
        List<TwcBndPrimaryKeyTest> twcBndPrimaryKeyTests = twcBndPrimaryKeyTestMapper.selectList(twcBndPrimaryKeyTestQueryWrapper);

        return twcBndPrimaryKeyTests;
    }


}
